<?php

function checkNameUniqueness($type, $name)
{
    $db = openConnection();
    $query = "SELECT name FROM all_quizzes WHERE type='" . $type . "' AND name='" . $name ."';";
    $query = queryDatabase($query, $db);
    return fetchResults($query); 
}

function insertIntoDataBase($type, $name)
{
    $db = openConnection();

    $query = "INSERT INTO " . strtolower($type) . "_quiz (name) VALUES ('" . $name . "');";
    $query = queryDatabase($query, $db);

    $query = "INSERT INTO all_quizzes (type, name) VALUES ('" . $type . "', '" . $name . "');";
    $query = queryDatabase($query, $db);
}

?>